package com.victor9ac.tfm.flickr.client;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

import com.flickr4java.flickr.photos.Photo;
import com.flickr4java.flickr.photos.PhotoList;
import com.victor9ac.tfm.flickr.client.FlickrClient;
import com.victor9ac.tfm.flickr.client.FlickrConnector;

public class FlickrClientIT {

	FlickrClient flickr4JavaService; 

	
	@Before
	public void setup(){
		FlickrConnector flickrConnector = new FlickrConnector();
		flickr4JavaService = new FlickrClient(flickrConnector);
	}

	
	@Test
	public void getPhotosFlickr4Java() throws Exception {
		
		long ini = System.currentTimeMillis();
		PhotoList<Photo> photoList = flickr4JavaService.getPhotos("Madrid");
		long end = System.currentTimeMillis();
		
		for (Photo photo : photoList) {
			
			System.out.println("Title: "+photo.getTitle()+"|| url: "+photo.getSmallUrl());
		}
		
		System.out.println("time elapsed: "+ (end-ini) +"ms.");
		
		assertNotNull("should returns any photos from flickr", photoList);
		
	}
}
